package cn.kgc.service.impl;

import cn.kgc.mapper.NoticeMapper;
import cn.kgc.pojo.NoticeInf;
import cn.kgc.service.NoticeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service("noticeService")
public class NoticeServiceimpl implements NoticeService {

    @Resource
    NoticeMapper noticeMapper;
    @Override
    public int getCount(String title, String content) {
        return 0;
    }

    @Override
    public List<NoticeInf> getNoticeByPage(Integer currentpageNo, Integer pageSize, String title, String content) {
        Integer pageNo = (currentpageNo-1)*pageSize;
        return noticeMapper.getNoticeByPage(pageNo,pageSize,title,content);
    }

    @Override
    public NoticeInf getNoticeInfById(Integer id) {
        return noticeMapper.getNoticeInfById(id);
    }

    @Override
    public boolean updateNoticeInf(NoticeInf noticeInf) {
        int conut = noticeMapper.updateNoticeInf(noticeInf);
        if (conut>0){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public boolean addNoticeInf(NoticeInf noticeInf) {
        int conut = noticeMapper.addNoticeInf(noticeInf);
        if (conut>0){
            return true;
        }else {
            return false;
        }
    }
    @Override
    public boolean delId(Integer id) {
        int conut = noticeMapper.delId(id);
        if (conut>0){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public NoticeInf getNoticeInftitle(String title) {
        return noticeMapper.getNoticeInftitle(title);
    }

    @Override
    public List<NoticeInf> getNoticeInfInfo() {
        return noticeMapper.getNoticeInfInfo();
    }
}
